home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / CLASSSRC.PAK / HEAPSEL.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  961b  |  35 lines

  1. //----------------------------------------------------------------------------
  2. // Borland Class Library
  3. // Copyright (c) 1993, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   5.6  $
  6. //
  7. //----------------------------------------------------------------------------
  8. #include <classlib/pch.h>
  9. #include <services/defs.h>
  10.  
  11. //
  12. // THeapSelector doesn't have to do anything special unless its under Win16.
  13. // Then we have to worry about multiple heaps.
  14. //
  15. #if defined(BI_PLAT_WIN16)
  16.  
  17. #include <classlib/heapsel.h>
  18. #include <services/wsysinc.h>
  19.  
  20. void _BIDSFARDATA *THeapSelector::Allocate( size_t sz ) const
  21. {
  22.     HeapSetup frame(FP_SEG(this));
  23.     return MK_FP( _DS, ::LocalAlloc( sz, LMEM_MOVEABLE ) );
  24. }
  25.  
  26. void THeapSelector::Free( void _BIDSFARDATA *block )
  27. {
  28.     HeapSetup frame(FP_SEG(block));
  29.     HANDLE hMem = ::LocalHandle( (void NEAR*)FP_OFF(block) );
  30.     if( hMem )
  31.         ::LocalFree( hMem );
  32. }
  33.  
  34. #endif
  35.